Skip to content

feat(reusable-ci): add opt-in fetch-base-branch-tip input to the Go CI job - #394

Merged
jdfalk merged 1 commit into
mainfrom
feat/reusable-ci-fetch-base-branch-tip
Nov 18, 2026
Merged

jdfalk merged 1 commit into
mainfrom
feat/reusable-ci-fetch-base-branch-tip

Conversation

@jdfalk

@jdfalk jdfalk commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

What

Adds an opt-in boolean workflow_call input, fetch-base-branch-tip (default false), to reusable-ci.yml. When true, the go-ci job runs a new step right after "Checkout repository":

git fetch --no-tags --depth=1 origin "${DEFAULT_BRANCH}"
git rev-parse --verify "origin/${DEFAULT_BRANCH}"

DEFAULT_BRANCH is passed through env: from github.event.repository.default_branch, never interpolated into the script. The step uses shell: bash so it also works on any non-Linux matrix entry.

Why

A consumer test diffs a file against the default branch. go-ci checks out at depth 1 with no base ref, so origin/<default> does not exist and the test fails by design (it refuses to pass silently without a base). A caller cannot add steps to a reusable workflow's job, so the fetch has to live here.

Default unchanged

With the input unset or false the step is skipped and nothing else in the workflow changes. Other consumers pinned to @main are unaffected. Only the default branch's tip is fetched, not its history.

Verification

  • actionlint .github/workflows/reusable-ci.yml passes with no findings.
  • gitleaks on the staged diff is clean.
  • Not verified end to end: the new step only runs when a caller passes true, so it is first exercised by a consumer PR run against the merged workflow.

Includes a changelog.d fragment and the file version bump (1.21.0 to 1.22.0).

🤖 Generated with Claude Code

https://claude.ai/code/session_011To9HLujjbB26zYLfwT1HY

…I job

go-ci checks out at depth 1 with no base ref, so a consumer test that diffs a
file against the default branch cannot resolve origin/<default>. A caller cannot
add steps to a reusable workflow's job, so add a boolean input (default false)
that fetches the default branch's tip at depth 1 right after checkout and
verifies it resolves. The branch name is passed through env, not interpolated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011To9HLujjbB26zYLfwT1HY
@github-actions github-actions Bot added size/M github-actions GitHub Actions related work type:documentation Improvements or additions to documentation module:config Configuration management workflow:github-actions GitHub Actions workflows labels Nov 17, 2026
@jdfalk
jdfalk merged commit bd20b40 into main Nov 18, 2026
42 checks passed
@jdfalk
jdfalk deleted the feat/reusable-ci-fetch-base-branch-tip branch November 18, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github-actions GitHub Actions related work module:config Configuration management size/M type:documentation Improvements or additions to documentation workflow:github-actions GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant